import java.util.Arrays;

/**
 * @author LKQ
 * @date 2021/12/14 19:59
 * @description
 */
public class Solution {
    public static void main(String[] args) {
        Solution solution = new Solution();
        int[] nums = {2, 3, 4};
        solution.twoSum(nums, 6);
    }

    public int[] twoSum(int[] numbers, int target) {
        int left  = 0,  right = numbers.length - 1;
        while (left <= right){
            int temp = target - numbers[left];
            boolean isFinish = false;
            while (right > left) {
                if (numbers[right] != temp) {
                    right--;
                }else {
                    isFinish = true;
                    break;
                }
            }
            if (isFinish) {
                break;
            }
            right = numbers.length - 1;
            left++;
        }
        numbers[0] = left + 1;
        numbers[1] = right + 1;
        return Arrays.copyOf(numbers, 2);
    }
}
